package com.briup.pts.web.controller;

import com.briup.pts.config.response.Result;
import com.briup.pts.service.impl.AnalysisServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author wy
 * @description
 * @data 2024/11/29  11:35
 */
@Tag(name = "大屏模块")
@RequestMapping("/analysis")
@RequiredArgsConstructor
@RestController
public class AnalysisController {
    private final AnalysisServiceImpl service;

    @Operation(summary = "统计栏舍，栏圈，动物数量，冷库数量,员工数量")
    @GetMapping("/count")
    public Result<?> count(){
        Map<String, List<?>>count= service.count();
        return Result.success(count).apply("获取成功");
    }

    @Operation(summary = "统计动物体重信息")
    @GetMapping("/indexCount")
    public Result<?> indexCount(){
        Map<String,Integer> indexCount= service.indexCount();
        return Result.success(indexCount).apply("获取成功");
    }

    @Operation(summary = "统计动物病症数量")
    @GetMapping("/countDisease")
    public Result<?> countDisease(){
        Map<String,Integer> countDisease= service.countDisease();
        return Result.success(countDisease).apply("获取成功");
    }

    @Operation(summary = "统计本年度12个月销售动物")
    @GetMapping("/countSales")
    public Result<?> countSales(){
        Map<String,List<?>> countSales= service.countSales();
        return Result.success(countSales).apply("获取成功");
    }

}
